package com.gexiaobao.pigeon.viewmodel

import androidx.lifecycle.MutableLiveData
import com.gexiaobao.pigeon.app.model.bean.GatherFifteenVideoResponse
import com.gexiaobao.pigeon.app.model.bean.GatherLiveResponse
import com.gexiaobao.pigeon.app.network.apiService
import com.gexiaobao.pigeon.app.util.RxToast
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request

/**
 * @Author      : hxw
 * @Date        : 2024/7/30 11:36
 * @Describe    :
 */
class VideoViewModel : BaseViewModel() {

    /** 获取归巢视频 */
    val getGatherVideoResult: MutableLiveData<GatherFifteenVideoResponse> = MutableLiveData()
    fun getBackVideo(ringId: String, passId: Int) {
        request({ apiService.getBackVideo(ringId, passId) }, {
            getGatherVideoResult.value = it
        }, {
            RxToast.warning(it.msg)
        })
    }

    /** 获取集鸽15s视频 */
    fun getGatherVideo(gatherId: Int) {
        request({ apiService.getGatherVideo(gatherId) }, {
            getGatherVideoResult.value = it
        }, {
            RxToast.warning(it.msg)
        })
    }

    /** 获取归巢视频 */
    val passVideoResult: MutableLiveData<Any> = MutableLiveData()
    fun getPassVideo(passId: Int, pigeonId: Int, ringId: String) {
        request({ apiService.getPassVideo(passId, pigeonId, ringId) }, {
            passVideoResult.value = it
        }, {
            RxToast.warning(it.msg)
        })
    }

    /** 获取集鸽直播app */
    val getGatherLiveAppResult: MutableLiveData<GatherLiveResponse> = MutableLiveData()
    fun getGatherLiveApp(passId: Int) {
        request({ apiService.getGatherLiveApp(passId) }, {
            getGatherLiveAppResult.value = it
        }, {
            RxToast.warning(it.msg)
        })
    }

    /** 获取归巢直播 */
    fun getBackLiveApp(passId: Int) {
        request({ apiService.getBackLiveApp(passId) }, {
            getGatherLiveAppResult.value = it
        }, {
            RxToast.warning(it.msg)
        })
    }

}